Skip to content

docs: say which icebug algorithms use exported edge weights - #218

Merged
prrao87 merged 5 commits into
mainfrom
docs/weighted-icebug-algorithms
Nov 27, 2026
Merged

prrao87 merged 5 commits into
mainfrom
docs/weighted-icebug-algorithms

Conversation

@prrao87

@prrao87 prrao87 commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Why

#200 added edge weights to export_graph, and the docs said only that algorithms "such as ib.distance.Dijkstra" use them. That left readers to guess about the rest, and #200's note "Not covered: icebug's weighted community detection or centrality beyond Dijkstra" read as if the export didn't support them. It does: once Graph.fromCSR gets the weight arrays, icebug decides per algorithm whether to read them. Some algorithms in icebug 13.6 ignore them without a warning, one refuses a weighted graph, and two need an editable copy. This PR says which is which.

What changed

The weighted section is renamed "Edge weights" and now says the export carries no node weights. The icebug part of the graph algorithms page gets an "Edge weights in icebug" section:

  • A worked example. The section starts from the unweighted PageRank above it and reruns it on the page's messages export, showing how the scores move once follows carry weights.
  • A table per icebug module of the algorithms that use the weights and those that ignore them without a warning. For example, Betweenness, PLM (Louvain) and ParallelLeiden use them; KadabraBetweenness, TopCloseness and SpanningForest don't. ApproxElectricalCloseness raises an error on a weighted graph.
  • A copy for edge ids. SpanningEdgeCentrality and flow.EdmondsKarp need indexEdges(), which fails on a read-only fromCSR graph. They run on ib.Graph(graph, weighted=True, directed=...); without weighted=True the copy drops the weights. A max flow example on the same data shows it.
  • Limits that come from icebug. A note says these limits are in what icebug 13.6 supports, not in the export, so lance-csr can't work around them.
  • Length or strength. Shortest paths, betweenness and closeness read a weight as a length; PageRank, community detection, maximum spanning forests and matchings read it as a strength. The section shows how to pass the inverse, and that Dijkstra assumes no negative weights, which the export doesn't check.

The README drops its three test-status badges, which always show passing on main and so tell readers nothing. The license and package version badges stay.

Three new icebug tests check the claims: weighted betweenness takes the cheap route only, Louvain separates two groups of a complete graph by weight alone, and the copy keeps the weights (a max flow of 6 against 2 with unit capacities) while a plain copy drops them. Like the existing icebug tests, they skip when icebug isn't installed.

Validation

  • The table comes from running each algorithm on a 300-node, 2,400-edge random graph with unit and random weights and comparing outputs. For the randomized algorithms (approximate betweenness and closeness, Louvain, Leiden), results were compared with the exact weighted and unweighted answers instead, and for forests and matchings by the edges chosen. icebug's embedding, sparsification and link-prediction modules weren't checked.
  • The five icebug tests pass with uv run --no-sync --with icebug==13.6 --with networkx pytest python/tests/test_graph_export.py -k icebug; the Louvain test passed 15 runs out of 15.
  • Without icebug, the file passes with the icebug tests skipped (11 passed, 5 skipped).
  • Every Python block on the page, including the icebug ones marked skip-check, runs in order with icebug 13.6 and prints the outputs shown.
  • make lint, docs/check_snippets.py, zensical build --strict and typos: pass. CI hasn't run yet.

🤖 Generated with Claude Code

The graph algorithms page only said that algorithms such as Dijkstra use
the weights. In icebug 13.6 some algorithms ignore them without a warning,
one refuses weighted graphs, and two need an editable copy that keeps the
weights. List each, note which limits need icebug changes, and test
weighted betweenness, Louvain and the copy.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Deploying lance-csr with  Cloudflare Pages  Cloudflare Pages

Latest commit: fd4f2fe
Status: ✅  Deploy successful!
Preview URL: https://913735f2.lance-csr.pages.dev
Branch Preview URL: https://docs-weighted-icebug-algorit.lance-csr.pages.dev

View logs

Rename the weighted section to Edge weights and say the export has no
node weights. Introduce the icebug section with weighted PageRank on
the messages export, show where each variable comes from, give the max
flow example concrete ids and output, and describe the icebug limits
as what icebug supports rather than changes it needs.
Keyword arguments spare readers icebug's positional order, and a short
comment says what each CSR array holds.
Tests always pass on main, so the three test badges said nothing.
Show recent downloads from crates.io (90 days, its only recent count),
PyPI and npm (per month) in their place.
Download badges depend on registry APIs that rate-limit shields.io,
so readers could see an error instead of a count. Keep only the
license and version badges.
@prrao87
prrao87 merged commit 61599ef into main Nov 27, 2026
5 checks passed
@prrao87
prrao87 deleted the docs/weighted-icebug-algorithms branch November 27, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant